package com.zjc.springboot.nettyclient.config;

import com.zjc.springboot.nettyclient.client.NettyClient;
import com.zjc.springboot.nettyclient.client.NettyClient12;
import com.zjc.springboot.nettyclient.client.NettyClient15;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ConfigBeans {

    @Bean
    @ConditionalOnProperty(name = "netty.12.enable", havingValue = "true")
    public NettyClient nettyClient12(@Autowired Config12 config12) {
        return new NettyClient12(config12);
    }

    @Bean
    @ConditionalOnProperty(name = "netty.15.enable", havingValue = "true")
    public NettyClient nettyClient15(@Autowired Config15 config15) {
        return new NettyClient15(config15);
    }

}
